package com.ruoyi.wcf.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.wcf.domain.WcfDisposeRent;
import com.ruoyi.wcf.service.IWcfDisposeRentService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 客户管理-租金设置Controller
 *
 * @author ruoyi
 * @date 2022-03-30
 */
@RestController
@RequestMapping("/wcf/wcfDisposeRent")
public class WcfDisposeRentController extends BaseController
{
    @Autowired
    private IWcfDisposeRentService wcfDisposeRentService;

    /**
     * 查询客户管理-租金设置列表
     */
    @PreAuthorize("@ss.hasPermi('wcf:wcfDisposeRent:list')")
    @GetMapping("/list")
    public TableDataInfo list(WcfDisposeRent wcfDisposeRent)
    {
        startPage();
        List<WcfDisposeRent> list = wcfDisposeRentService.selectWcfDisposeRentList(wcfDisposeRent);
        return getDataTable(list);
    }

    /**
     * 导出客户管理-租金设置列表
     */
    @PreAuthorize("@ss.hasPermi('wcf:wcfDisposeRent:export')")
    @Log(title = "客户管理-租金设置", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WcfDisposeRent wcfDisposeRent)
    {
        List<WcfDisposeRent> list = wcfDisposeRentService.selectWcfDisposeRentList(wcfDisposeRent);
        ExcelUtil<WcfDisposeRent> util = new ExcelUtil<WcfDisposeRent>(WcfDisposeRent.class);
        return util.exportExcel(list, "客户管理-租金设置数据");
    }

    /**
     * 获取客户管理-租金设置详细信息
     */
    @PreAuthorize("@ss.hasPermi('wcf:wcfDisposeRent:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(wcfDisposeRentService.selectWcfDisposeRentById(id));
    }

    /**
     * 新增客户管理-租金设置
     */
    @PreAuthorize("@ss.hasPermi('wcf:wcfDisposeRent:add')")
    @Log(title = "客户管理-租金设置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WcfDisposeRent wcfDisposeRent)
    {
        return toAjax(wcfDisposeRentService.insertWcfDisposeRent(wcfDisposeRent));
    }

    /**
     * 修改客户管理-租金设置
     */
    @PreAuthorize("@ss.hasPermi('wcf:wcfDisposeRent:edit')")
    @Log(title = "客户管理-租金设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WcfDisposeRent wcfDisposeRent)
    {
        return toAjax(wcfDisposeRentService.updateWcfDisposeRent(wcfDisposeRent));
    }

    /**
     * 删除客户管理-租金设置
     */
    @PreAuthorize("@ss.hasPermi('wcf:wcfDisposeRent:remove')")
    @Log(title = "客户管理-租金设置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(wcfDisposeRentService.deleteWcfDisposeRentByIds(ids));
    }
}
